package com.atguigu.tingshu.order.client;

import com.atguigu.tingshu.model.order.OrderInfo;
import com.atguigu.tingshu.order.service.OrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/***
 * 订单微服务提供的内部调用层
 */
@RestController
@RequestMapping("/client/order/orderInfo")
public class OrderInfoController {

    @Autowired
    private OrderInfoService orderInfoService;


    /**
     * 获取订单信息
     */

    @GetMapping("getOrderInfo/{trackId}")
    public List<OrderInfo> getOrderInfo (@PathVariable(value = "trackId") Long trackId){
        return orderInfoService.getTrackOrderInfo(trackId);
    }

    /**
     * 获取当前用户未支付的订单信息
     * @param userId
     * @return
     */
    @GetMapping("/getUserTrackOrderInfo/{userId}")
    Map<String, Object> getUserTrackOrderInfo(Long userId){
        return orderInfoService.getUserTrackOrderInfo(userId);
    }
}
